#include "game.h"

void PersonState::ChangeState(PersonManager* p, PersonState *s)
{
    p->ChangeState(s);
}

void IdleState::Do1(PersonManager *p)
{
    qInfo()<<"IdleState"<<__FUNCTION__;
    ChangeState(p, WalkState::instance());
}

void IdleState::Do2(PersonManager *p)
{
    qInfo()<<"IdleState"<<__FUNCTION__;
    ChangeState(p, RunState::instance());
}

void WalkState::Do1(PersonManager *p)
{
    qInfo()<<"WalkState"<<__FUNCTION__;
    ChangeState(p, RunState::instance());
}

void WalkState::Do2(PersonManager *p)
{
    qInfo()<<"WalkState"<<__FUNCTION__;
    ChangeState(p, IdleState::instance());
}

void RunState::Do1(PersonManager *p)
{
    qInfo()<<"RunState"<<__FUNCTION__;
    p->ChangeState(IdleState::instance());
}

void RunState::Do2(PersonManager *p)
{
    qInfo()<<"RunState"<<__FUNCTION__;
    ChangeState(p, WalkState::instance());
}

PersonManager::PersonManager()
{
    _state = IdleState::instance();
}
